home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
cdtect.zip
/
CDTECT.ASM
next >
Wrap
Assembly Source File
|
1988-04-05
|
2KB
|
49 lines
page 48,132
cseg segment
assume cs:cseg,ds:cseg
org 100h
;
; CDTECT.ASM
; This program by Ed Barboni 4/5/88. Ver 1.0
; It was a quick 'hack', so please, no comments about it's structure,
; or lack thereof!
; Any comments, or suggestions may be directed to me on my BBS,
; 'System-2' (215) 584-1412.
;
; I wrote this to solve a simple need to control my batch files upon
; the Status of the Carrier Detect bit on a com port.
; It is 'hard coded' to test for Carrier Detect on my system set up
; as COM1. There is no guarantee that it will work on your system.
;
; IF there is any interest, I will write it to accept the comport number
; as a command line argument, (i.e. 'CDTECT 1' or 'CDTECT 2'), but for
; now, to use on other than COM1 requires modification and re assembly.
;
; Usage:
; When invoked, CDTECT simply executes, and uses int 21h to set
; the DOS ERRORLEVEL according to whether it found Carrier Detect
; on COM1.
; For instance, If you want to jump to a label 'yescar' if CD is
; still true, use this...
;
; CDTECT
; IF ERRORLEVEL 2 goto yescar
;
; CDTECT returns ERRORLEVEL equal to 2 if CD is true, and
; ERRORLEVEL equal to 1 if CD false. The best use is to test
; for CD true in your batch file as above.
;
;
mov dx,1022d ;move port # to DX (COM1 modm stat reg)
in al,dx ;return contents of port to al
cmp al,127d ;if it's > 127, CD is true
ja cardet ;jump if carrier detect true
nocar: mov al,1 ;errorlevel = 1 if no carrier
jmp exiter ;skip over carrier= true
cardet: mov al,2 ;errorlevel=2 if carrier
exiter: mov ah,4ch ;set up exit
int 21h ;exit and return Dos errorlevel = to al
;
cseg ends
end